<?php

namespace liketp\console\command;

use liketp\console\BaseCommand;
use liketp\socket\SocketWorker;

class Icq extends BaseCommand
{
    protected $defaultOptions = [
        '--ip' => [
            'type' => 'string',
            'default' => '127.0.0.1'
        ],
        '--port' => [
            'type' => 'number',
            'default' => 9527
        ]
    ];

    public function exec()
    {
        $ip = $this->option('ip');
        $port = $this->option('port');

        $sw = app(SocketWorker::class, [$ip, $port]);
        $sw->setHandle(app('socket.event_handle'));
        $sw->run();
    }
}
